<%@ Page Language="C#" AutoEventWireup="true" Inherits="Syrinx.Gui.AspNet.Nitobi2.NitobiBasePage" 
	 MasterPageFile="~/App_ThemeMasters/NoStyle/popUpTwoColumnLayout.Master" %>
<%@ Register Assembly="Swaf.Gui.AspNet2" Namespace="Swaf.Gui.AspNet2" TagPrefix="swf" %>
<%@ Register Assembly="ScsAspNet" Namespace="Syrinx.Gui.AspNet.Nitobi2" TagPrefix="snc" %><%@ Register Assembly="NitobiControls" Namespace="Nitobi" TagPrefix="ntb" %>

<asp:Content ContentPlaceHolderID="title" ID="c01" runat="server">
 <div class="left"><h1><asp:Label ID="ImgCacheLibLbl" runat="server" > Image Cache Library</asp:Label></h1></div>
<swf:BizProc ID="settings" runat="server" FactoryName="mediaCache">
</swf:BizProc>

 <swf:BizProc runat="server" ID="adl" factoryName="mediaDirectoryLibrary">
	<State entireTree="false" EditModeSessionKey="GlobalEdit" includeSelf="true" />
	<ParentBizProc id="settings" fieldName="id" dataId="pid" />
</swf:BizProc>
<swf:BizProc runat="server" ID="ail" FactoryName="mediaImagesLibrary">
	<ParentBizProc id="adl" fieldName="keyName" dataId="pid" />
	<ParentBizProc id="settings" fieldName="id" dataId="cid" />
</swf:BizProc>
<div style="background-image: url(/img/syrinxphimages/MapPin/default.png); background-repeat: no-repeat;" class="ntb-image"><img src="/img/syrinxphimages/MapPin/default.png" style="visibility: hidden;" align="middle" border="0"></div>
<script type="text/javascript">
	var cacheName = "";
	var selectedImage = "";
	var imageSize = "Thumbnail";
	var width = null, height = null;
debugger;
	var bizObj = null;
	var imageFieldName = null;
	var info = window.dialogArguments;
	if (info != null) {
		imageFieldName = info.imageFieldName;
		bizObj = info.bizObj;
		var fullImage = bizObj.getAttribute(imageFieldName);
		var m = fullImage.match(/\/img\/([^\/]+)\/([^\/]+)\/(.*)$/);
		if (m != null) {
			cacheName = m[1];
			selectedImage = m[3];
		}
	}

	function pickImage() {
		if (bizObj != null) {
			var n = cacheName + "/MapPin/" + selectedImage;
			bizObj.setAttribute(imageFieldName, n);
			window.returnValue = bizObj;
			window.close();
		}
	}
</script>
</asp:Content>

<asp:Content ContentPlaceHolderID="leftContent" ID="c02" runat="server">
	<asp:Label runat="server" ID="cachlistLbl" Text="Company Image Caches:" />
	<snc:Combo ID="caches" runat="server" ParentBizProcIds="settings" DataTextField="name" DataValueField="id">
		<ClientEvents Select="cacheName = this.GetSelectedRowValues()[1];" />
		<Columns>
			<ntb:BoundColumn DataField="id" Visible="false" />
			<ntb:BoundColumn DataField="name" HeaderText="Name" width="200" />
		</Columns>
	</snc:Combo>
	<snc:Grid ID="articleList1Display" runat="server" Width="273px" Height="425px" Resizable="Both" ShowToolbar="false" ParentBizProcIds="adl" Mode="LiveScrolling">
		<Columns>
			<ntb:KeyColumn DataField="keyName"  />
			<ntb:BoundColumn DataField="depthName" HeaderText="Name" width="200" />
			<ntb:NumberColumn DataField="fileCount" HeaderText="Num Files" width="56" Mask="#,###" />
			<ntb:BoundColumn DataField="xx" Width="40" />
		</Columns>
	</snc:Grid>
	
	<swf:BizProc runat="server" ID="ap" FactoryName="actionParam">
		<ParentBizProc id="ail" fieldName="name" dataId="pid" />
	</swf:BizProc>
		
</asp:Content>
<asp:Content ContentPlaceHolderID="rightContent" ID="c03" runat="server">
<ntb:TabStrip runat="server" id="tabs" Width="500" Height="600">
	<AutoSize FixedHeightMargin="65" FixedWidthMargin="5" MarginWidthDomId="leftArea" />
	<TabItems>
		<ntb:TabItem NamedId="ta1" Name="Images" width="125" />
		<ntb:TabItem Name="Upload" NavigationUrl="ImageUploadPopupChild.aspx" width="125" />
	</TabItems>
</ntb:TabStrip>
		<div id="ta1">
	        <snc:ComplexBizObjListDisplay runat="server" ID="miImages" 
		        ReadOnlyTemplate="MediaCache.Gui.AspNet.ImagesListDisplay-ClientSelect" 
		        ParentBizProcIds="ail">
		        <macros>
			        <Entry name="navLink" type="String">imageviewer.aspx</Entry>
		        </macros>
	        </snc:ComplexBizObjListDisplay>
		</div>
</asp:Content>
<asp:Content ContentPlaceHolderID="buttons" ID="c04" runat="server">
	<div style="float:left;">
			<button onclick="pickImage();" type="button">Ok</button>
	</div>
</asp:Content>

